deadlock avoidance

 

Requires that the system has some additional a priori information available.

  1. Simplest and most useful model requires that each process declare the maximum number of resources of each type that it may need.process declare the maximum number of resources of

each type that it may need.

  1. The deadlock-avoidance algorithm dynamically examines the resource-allocation state to ensure that there can never be a circular-wait condition.the resource-allocation state to ensure that there can never be a circular-wait condition.
  2. Resource-allocation state is defined by the number of available and allocated resources, and the maximum demands of the processes.

 

Safe State :

 

  1. When a process requests an available resource, system must decide if immediate allocation leaves the system in a safe state.
  2. System is in safe state if there exists a safe sequence of all processes.
  3. Sequence <P1, P2, …, Pn> is safe if for each Pi, the resources that Pi can still request can be satisfied by currently available resources + resources held by all the Pj, with j<I.
    1. If Pi resource needs are not immediately available, then Pi can wait

            until all Pj have finished.

    1. When Pj is finished, Pi can obtain needed resources, execute, return allocated resources, and terminate.

 

Basic Facts

 

  •  If a system is in safe state ,no deadlocks.
  • If a system is in unsafe state ,possibility of deadlock.
  • Avoidance ensure that a system will never enter an unsafe state.

Safe, Unsafe , Deadlock State

 

Resource-Allocation Graph Algorithm

 

  1. Claim edge Pi à  Rj indicated that process Pj may request resource Rj; represented by a dashed line.
  2. Claim edge converts to request edge when a process requests a resource.When a resource is released by a process, assignment edge reconverts to a claim edge.Resources must be claimed a priori in the system.

 

Next

 

 

 

 

 

 

 

 

 

 

 

Deadlock by V. Vanthana, Dept of CA